//设置操作权限
pId = "";
conditonId = "UserID";
selectId = "RoleID";
var fnSetFunctionRight = function () {
    var row = fnGetSelectedRow();
    pId = row["RoleID"];
    conditonId = "UserID";
    selectId = "RoleID";
    var formURL = "/EditWidows/YUITree.aspx?masterentity=SysRoleFunction&masterPara=SysFunction|Name|FunctionID|ParentID|FunctionPath|True";
    _EditDataURL = formURL;
    if ($("#btn_dialog_open").length > 0) {
        $("#btn_dialog_open").click();
        return;
    }
}

var fnViewUser = function () {
    var row = fnGetSelectedRow();
    var RoleID = row["RoleID"]; 
    selectId = "RoleID";
    var condition = "RoleID='" + RoleID + "'";
    var formURL = "/Extend/ViewList.aspx?isShonwBtn=Y&roleid=" + RoleID + "&entity=V_UserRole&condition=" + condition;
    _EditDataURL = formURL;

    if ($("#btn_dialog_open").length > 0) {
        $("#btn_dialog_open").click();
        return;
    }
}

var fnSetRolePosts = function () {
    var row = fnGetSelectedRow();
    var RoleID = row["RoleID"] ;
    selectId = "RoleID";
    var condition = "RoleID='" + RoleID + "'";
    var formURL = "/Extend/ViewList.aspx?isShonwBtn=Y&roleid=" + RoleID + "&entity=V_PostRole&condition=" + condition;
    _EditDataURL = formURL;

    if ($("#btn_dialog_open").length > 0) {
        $("#btn_dialog_open").click();
        return;
    }
}
//设置功能权限
var fnSetOperationRight = function () {
    var row = fnGetSelectedRow();
    RoleID = row["RoleID"];
    selectId = "RoleID";
    var condition = "RoleID='" + RoleID + "'";
    formURL = "/Extend/RightSeting.aspx?r=" + Math.random() + "&entity=V_FunctionRight&order=FunctionPath&condition=" + condition;
    _EditDataURL = formURL;
    if ($("#btn_window_open").length > 0) {
        $("#btn_window_open").click();
        return;
    }
}


var fnSetDeskTopItem = function () {
    var row = fnGetSelectedRow();
    RoleID = row[const_entityID];
    selectId = "RoleID";
    var condition = "RoleID='" + RoleID + "'";
    var url = "/DeskTop/Form/DesktopConfigForAdmin.aspx?r=" + Math.random() + "&entity=Set_DesktopItem" + "&RoleID=" + RoleID;
    parent.addTabs("桌面配置", url);

}

var fnCustomAdd = function () {
    var formURL = "/Extend/AutoEditUI.aspx?r=" + Math.random() + "&entity=" + const_EditEntity;
    if (typeof (fnGetData) == "function") {
        var e = fnGetData("SysCustomDefineForm", "MasterTableName='" + const_EditEntity + "'");
        if (e != null) {
            formURL = "/Extend/AutoLoadForm.aspx?r=" + Math.random() + "&entity=" + const_EditEntity;
        }
        //document.getElementById("EditUIWindow").src = "AutoLoadForm.aspx?r=" + Math.random() + "&entity=" + const_EditEntity;
    }


    _EditDataURL = formURL;
    if ($("#btn_dialog_open").length > 0) {
        $("#btn_dialog_open").click();
        return;
    }
}

var fnCustomEdit = function () {
    var row = fnGetSelectedRow();
    var formURL = "/Extend/AutoEditUI.aspx?r=" + Math.random() + "&entity=" + const_EditEntity + "&id=" + row["RoleID"];
    if (typeof (fnGetData) == "function") {
        var e = fnGetData("SysCustomDefineForm", "MasterTableName='" + const_EditEntity + "'");
        if (e != null) {
            formURL = "/Extend/AutoLoadForm.aspx?r=" + Math.random() + "&entity=" + const_EditEntity;
        }
        //document.getElementById("EditUIWindow").src = "AutoLoadForm.aspx?r=" + Math.random() + "&entity=" + const_EditEntity;
    }

    _EditDataURL = formURL;
    if ($("#btn_dialog_open").length > 0) {
        $("#btn_dialog_open").click();
        return;
    }
}

//loadJS("/scripts/ctrls/jquery.fixed.dialog.js");
